#include "HeadFiles.h"

CBullet::CBullet(COORD pos, Direction dir):Object(pos)
{
	this->dir = dir;
}

void CBullet::Show()
{
	CBuffer::Instance()->CN_Write(aftpos.X, aftpos.Y, "*");
}

void CBullet::Update()
{
	switch (dir)
	{
	case UP:
		this->pos.Y--;
		break;
	case DOWN:
		this->pos.Y++;
		break;
	case LEFT:
		this->pos.X--;
		break;
	case RIGHT:
		this->pos.X++;
		break;
	default:
		break;
	}
}

void CBullet::Init()
{
	pos = { 0,0 };
	aftpos = { 0,0 };
	dir = UP;
}

void CBullet::SetPosofshow(int x, int y)
{
	this->aftpos.X = x;
	this->aftpos.Y = y;
}

COORD* CBullet::ReturnPos()
{
	return &this->pos;
}
